﻿using System.Windows;
using tumblr.Models;

namespace tumblr.Views.TemplateSelectors
{
    public class PostTemplateSelector : DataTemplateSelector
    {
        public DataTemplate AudioPostTemplate { get; set; }
        public DataTemplate ChatPostTemplate { get; set; }
        public DataTemplate PhotoPostTemplate { get; set; }
        public DataTemplate LinkPostTemplate { get; set; }
        public DataTemplate QuotePostTemplate { get; set; }
        public DataTemplate TextPostTemplate { get; set; }
        public DataTemplate VideoPostTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            switch (item.GetType().Name)
            {
                case "AudioPostModel":
                    return AudioPostTemplate;

                case "ChatPostModel":
                    return ChatPostTemplate;

                case "PhotoPostModel":
                    return PhotoPostTemplate;

                case "LinkPostModel":
                    return LinkPostTemplate;

                case "QuotePostModel":
                    return QuotePostTemplate;

                case "TextPostModel":
                    return TextPostTemplate;
                    
                case "VideoPostModel":
                    return VideoPostTemplate;

                default:
                    return base.SelectTemplate(item, container);
            }
        }
    }
}
